var ctxs

let init = () => {
    let canvas = document.getElementById("map")
    let ctx = canvas.getContext('2d')
    this.ctxs = ctx
    for (let i = 0; i < 16; i++) {
        let t = 33.3
        ctx.beginPath()
        ctx.moveTo(t, i * t)
        ctx.lineTo(500, i * t)
        ctx.moveTo(i * t, t)
        ctx.lineTo(i * t, 500)
        ctx.stroke()
    }
    return canvas
}
let setChess = (x,y) => {
    console.log(x + " " + y);
    
    let w = (document.body.scrollWidth - 500)/2
    let h = document.body.scrollHeight
    x = x - w
    y = y - (h - (h/100*15) - 584)




    
    this.ctxs.beginPath();
    this.ctxs.arc(x, y, 13, 0, 2 * Math.PI);
    
    this.ctxs.stroke();

}

export default {
    init,
    setChess,

}
